package com.example.modelsystem.dao;

import com.example.modelsystem.entity.SysUserEntity;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface SysUserMapper {

    @Insert("INSERT INTO sys_user(username, password) VALUES(#{username}, #{password})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insertUser(SysUserEntity user);

    @Select("SELECT * FROM sys_user WHERE username = #{username}")
    SysUserEntity findByUsername(@Param("username") String username);

    @Update("UPDATE sys_user SET password = #{password} WHERE username = #{username}")
    Integer updateByUsername(@Param("username") String username,@Param("password") String password);


}